Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@wry/equality
Advanced tools
@wry/equality is a lightweight JavaScript library designed to perform deep equality checks. It is particularly useful for comparing complex objects and arrays to determine if they are equivalent in value.
Deep Equality Check
This feature allows you to perform deep equality checks between two objects or arrays. The `equal` function will return `true` if the objects or arrays have the same structure and values.
const { equal } = require('@wry/equality');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(equal(obj1, obj2)); // true
Shallow Equality Check
This feature allows you to perform shallow equality checks between two arrays. The `equal` function will return `true` if the arrays have the same elements in the same order.
const { equal } = require('@wry/equality');
const arr1 = [1, 2, 3];
const arr2 = [1, 2, 3];
console.log(equal(arr1, arr2)); // true
Lodash's `isEqual` function provides deep equality checks similar to @wry/equality. It is part of the larger Lodash utility library, which offers a wide range of utility functions for JavaScript. While `lodash.isequal` is more feature-rich, it also comes with the overhead of the entire Lodash library.
The `fast-deep-equal` package is another lightweight library for deep equality checks. It is known for its performance and minimalistic approach, making it a good alternative to @wry/equality for projects that require high performance.
The `deep-equal` package is a popular choice for deep equality checks. It is robust and well-maintained, offering similar functionality to @wry/equality. However, it may not be as lightweight as @wry/equality.
Structural equality checking for JavaScript values, with correct handling of cyclic references, and minimal bundle size.
FAQs
Structural equality checking for JavaScript values
The npm package @wry/equality receives a total of 3,238,695 weekly downloads. As such, @wry/equality popularity was classified as popular.
We found that @wry/equality demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.